#ifndef _QI_VARS_H
#define _QI_VARS_H

#include "../q_common.h"



enum qi_scopetype {SCOPE_NORMAL = 0, SCOPE_FUNC, SCOPE_GLOBAL};


/* type definition */


struct qi_variable
{
	char name[Q_MAX_VAR_NAME_LENGTH];
	/* is array? */
	int array;
	int reference;
	int constant;
	/* poiter to variable type */
	struct qi_type* type;
};

struct qi_scope
{
	enum qi_scopetype type;
	struct qi_variable* vars[Q_HASH_TABLE_SIZE];
	struct qi_scope* prev;
};

struct qi_scopecontainer
{
	struct qi_scope* global;
	struct qi_scope* current;
};




/* variables */
extern struct qi_scopecontainer qi_variables;
int qi_addvariable(const char* const vname, const char* const tname);
void qi_freevariables();


/* validating funcs */
int validatevar(const char* const start, const char* const end);


struct qi_type* qi_typelookup(const char* const name);
struct qi_variable* qi_variablelookup(const char* const name);


#endif
